#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>

int main()
{
    pid_t id1=fork();
    if(id1==0)
    {
        printf("I am child1,pid= %d\n",getpid());
        sleep(5);
        return 0;
    }

    pid_t id2=fork();
    if(id2==0)
    {
        printf("I am child2,pid= %d\n",getpid());
        sleep(1);
        return 0;
    }

    int status = 0;
    int ret = waitpid(id1, &status, 0);

    printf("wait over,pid=%d,status=%d\n",ret,status);
    sleep(10);

    return 0;
}